package com.hqyj.dao;

import com.hqyj.pojo.TbBuilding;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;

/**
 * <p>
 * 楼栋表 Mapper 接口
 * </p>
 *
 * @author gp
 * @since 2021-09-25
 */
@Repository
public interface TbBuildingMapper extends BaseMapper<TbBuilding> {
    /**
    * @Author:YaoHaoHong
    * @Description:
    * @Date:2021/9/29 11:59
    */
    @Select("select * from tb_building where community_name = #{communityName}")
    List<TbBuilding> queryByName(String name);

    /**
     * 映射 TbCommunityMapper 联合查询
     * @Author:franxhao
     */
    @Select("select * from tb_building where community_id = #{id}")
    List<TbBuilding> getBuildingsByCommunityId(Integer id);

    /**
     * 通过 id 获取楼栋名
     * @Author:franxhao
     */
    @Select("select name from tb_building where id = #{id}")
    String getNameById(Integer id);
}
